package com.meirimoney.app.control;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;

import com.meirimoney.app.R;

public class MenuBar extends BaseLinearLayout implements Navigation,
		OnClickListener {

	public MenuBar(Context context, AttributeSet attrs) {
		super(context, attrs);
		this.activity = (Activity)context;
		View panel = ((LayoutInflater) this.activity
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
				R.layout.mrm_menu_bar, this, true);
		this.title = (TextView) panel.findViewById(R.id.title);
		this.backBtn = (TextView) panel.findViewById(R.id.backButton);
		this.backBtn.setOnClickListener(this);
	}

	@Override
	public void setTitle(String title) {
		this.title.setText(title);
	}

	@Override
	public String getTitle() {
		return this.title.getText().toString();
	}

	@Override
	public void onClick(View v) {
		this.activity.finish();
	}

	private Activity activity;
	private TextView backBtn;
	private TextView title;
}
